package First;

import java.io.Serializable;

public class MobileCard implements Serializable {
    private String cardNumber;    // 卡号
    private String userName;      // 用户名
    private String passWord;      // 密码
    private ServicePackage serPackage; // 所属套餐
    private double consumAmount;  // 当月消费金额
    private double money;         // 账户余额
    private int realTalkTime;     // 实际通话时长(分钟)
    private int realSMSCount;     // 实际短信条数
    private int realFlow;         // 实际上网流量(MB)

    // 构造方法
    public MobileCard() {}

    public MobileCard(String cardNumber, String userName, String passWord,
                      ServicePackage serPackage, double money) {
        this.cardNumber = cardNumber;
        this.userName = userName;
        this.passWord = passWord;
        this.serPackage = serPackage;
        this.money = money;
    }

    // Getter和Setter方法
    public String getCardNumber() {
        return cardNumber;
    }

    public void setCardNumber(String cardNumber) {
        this.cardNumber = cardNumber;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public ServicePackage getSerPackage() {
        return serPackage;
    }

    public void setSerPackage(ServicePackage serPackage) {
        this.serPackage = serPackage;
    }

    public double getConsumAmount() {
        return consumAmount;
    }

    public void setConsumAmount(double consumAmount) {
        this.consumAmount = consumAmount;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        if (money < 0) {
            System.out.println("警告:账户余额不能为负数！");
            this.money = 0;
        } else {
            this.money = money;
        }
    }

    public int getRealTalkTime() {
        return realTalkTime;
    }

    public void setRealTalkTime(int realTalkTime) {
        this.realTalkTime = realTalkTime;
    }

    public int getRealSMSCount() {
        return realSMSCount;
    }

    public void setRealSMSCount(int realSMSCount) {
        this.realSMSCount = realSMSCount;
    }

    public int getRealFlow() {
        return realFlow;
    }

    public void setRealFlow(int realFlow) {
        this.realFlow = realFlow;
    }

    // 显示卡信息
    public void showMeg() {
        System.out.println("卡号：" + cardNumber);
        System.out.println("用户名：" + userName);
        System.out.println("当前余额：" + money + "元");
        serPackage.showInfo();
        System.out.println("当月通话时长：" + realTalkTime + "分钟");
        System.out.println("当月短信条数：" + realSMSCount + "条");
        System.out.println("当月上网流量：" + realFlow + "MB");
        System.out.println("当月消费金额：" + consumAmount + "元");
    }
}